package com.wty.cmims.controller;

import com.wty.cmims.pojo.ResponseResult;
import com.wty.cmims.service.AppointmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/appointment")
@Tag(name = "预约信息", description = "社区医疗信息管理系统api接口")
public class AppointmentController {
    @Autowired
    private AppointmentService appointmentService;
    // 添加预约
    @PostMapping("/addAppointment")
    @Operation(summary = "添加预约", description = "添加预约")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String,Object>> appointmentAdd(@RequestBody Map<String,Object> paramsMap){
        return appointmentService.appointmentAdd(paramsMap);
    }

    // 查询预约状态
    @PostMapping("/findAppointmentStatus")
    @Operation(summary = "查询预约状态", description = "查询预约状态")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> appointmentStatusFind(@RequestBody Map<String,Object> paramsMap){
        return appointmentService.appointmentStatusFind(paramsMap);
    }

    // 取消预约
    @PutMapping("/cancelAppointment")
    @Operation(summary = "取消预约", description = "取消预约")
    @Parameter(name = "appointmentId",description = "预约ID")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Void> appointmentCancel(@RequestBody Map<String,Object> paramsMap){
        return appointmentService.appointmentCancel(paramsMap);
    }

    // 获取预约记录
    @PostMapping("/findAppointmentRecords")
    @Operation(summary = "获取预约记录", description = "获取预约记录")
    @Parameter(name = "paramsMap",description = "参数列表")
    @ApiResponse(description = "处理结果",content = {
            @Content(
                    mediaType="application/json",
                    schema= @Schema(implementation = ResponseResult.class)
            )
    })
    public ResponseResult<Map<String, Object>> appointmentRecordsFind(@RequestBody Map<String, Object> paramsMap) {
        return appointmentService.appointmentRecordsFind(paramsMap);
    }
}